using System;
using System.IO;
using System.Security.Principal;
using System.Text;
using Jink.Protocol.Core;
using Jink.Protocol.Core.Headers;
using Jink.Protocol.Core.Verbs;
using XenoGears.Collections.Dictionaries;
using XenoGears.Functional;
using Jink.Protocol.Media.Http;
using XenoGears.Reflection;

namespace Jink.Playground.MockProtocol
{
    internal class MockRequestMedia : IRequestMedia
    {
        private readonly String _url;
        private readonly Verb _verb;
        private readonly ReadOnlyDictionary<String, String> _form;

        public MockRequestMedia(String url, String verb)
            : this(url, verb, null)
        {
        }

        public MockRequestMedia(String url, String verb, Object form)
        {
            _url = url;
            if (!_url.StartsWith("/")) _url += "/";
            _verb = verb.ToVerb();
            _form = (form ?? new {}).ToPropertyBag().Cast<String, String>().ToReadOnly();
        }

        public IPrincipal User { get { return null; } }
        public String AbsoluteUrl { get { return "jink://server" + _url; } }
        public String RelativeUrl { get { return _url; } }
        public Verb Verb { get { return _verb; } }
        public ReadOnlyDictionary<RequestHeader, String> Headers { get { return null; } }
        public ReadOnlyDictionary<String, String> Cookies { get { return null; } }
        public ReadOnlyDictionary<String, String> Form { get { return _form; } }
        public Encoding ContentEncoding { get { return null; } }
        public String ContentType { get { return null; } }
        public Stream ContentStream { get { return null; } }
    }
}